import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class Window extends JFrame
{
	private MButton[] buttons;
	private JLabel[] labels;
	private MButton change;
	private JCheckBox[] choose;
	private JTextField priceChoose;
	private JTextArea field;
	
	public Window()
	{
		super("BADUGA");
		
		
		JPanel all = new JPanel(new GridLayout(2, 2));
		setSize(640, 480);
		
		buttons = new MButton[6];
		labels = new JLabel[15];
		String[] nameBut = {"CHECK", "BET", "RAISE", "CALL", "FOLD", "ALL-IN"};
		String[] nameLab = {"News", "Name:", "EMPTY", "Port:", "EMPTY", 
							"Credit:", "EMPTY", "Given money:", "0", 
							"Pot:", "0", "Card1 ", "Card2 ", "Card3 ", "Card4 "};
		field = new JTextArea(10, 25);
		field.setEditable(false);
		
		for(int i = 0; i < 6; i++)
			buttons[i] = new MButton(nameBut[i]);
		
		for(int i = 0; i < 15; i++)
			labels[i] = new JLabel(nameLab[i]);
		
		JPanel serverNews = new JPanel(new BorderLayout());
		JScrollPane pane = new JScrollPane(field);
		pane.createVerticalScrollBar();
		serverNews.add(labels[0], BorderLayout.PAGE_START);
		serverNews.add(pane, BorderLayout.LINE_START);
		
		JPanel settings = new JPanel(new GridLayout(3, 2));
		settings.add(labels[1]);
		settings.add(labels[2]);
		settings.add(labels[3]);
		settings.add(labels[4]);
		settings.add(new JPanel());
		settings.add(new JPanel());
		
		JPanel money = new JPanel(new GridLayout(3, 2));
		money.add(labels[5]);
		money.add(labels[6]);
		money.add(labels[7]);
		money.add(labels[8]);
		money.add(labels[9]);
		money.add(labels[10]);
		
		JPanel smaller = new JPanel(new GridLayout(2, 2));
		smaller.add(settings);
		smaller.add(money);
		
		JPanel cards = new JPanel(new GridLayout(4, 4));
		
		choose = new JCheckBox[4];
		for(int i = 0; i < 4; i++)
		{
			labels[i + 11] = new JLabel(nameLab[i + 11]);
			choose[i] = new JCheckBox("CHOOSE");
		}
		
		change = new MButton("CHANGE");
		
		for(int i = 0; i < 4; i++)
			cards.add(new JPanel());
		for(int i = 11; i < labels.length; i++)
			cards.add(labels[i]);
		for(int i = 0; i < 4; i++)
			cards.add(choose[i]);
		cards.add(change);
		for(int i = 1; i < 4; i++)
			cards.add(new JPanel());
		
		JPanel controler = new JPanel(new GridLayout(5, 2));
		controler.add(new JPanel());
		controler.add(new JPanel());
		buttons = new MButton[6];
		for(int i = 0; i < 6; i++)
		{
			buttons[i] = new MButton(nameBut[i]);
			controler.add(buttons[i]);
		}
		
		JLabel bet = new JLabel("Choose price: ");
		controler.add(bet);		
		priceChoose = new JTextField("");
		controler.add(priceChoose);
		
		all.add(serverNews);
		all.add(smaller);
		all.add(cards);
		all.add(controler);
		add(all);
		setVisible(true);
	}
	
	public JLabel getNameLab()
	{
		return labels[2];
	}
	
	public JLabel getPortLab()
	{
		return labels[4];
	}
	
	public JLabel getLabel(int i)
	{
		return labels[i];
	}
	
	public JCheckBox[] getChoose()
	{
		return choose;
	}
	
	public JTextArea getArea()
	{
		return field;
	}
	
	public JTextField getPrice()
	{
		return priceChoose;
	}
	
	public MButton getButton(int i)
	{
		return buttons[i];
	}
	
	public MButton getChange()
	{
		return change;
	}
}

class MButton extends JButton
{
	private String name;
	
	public MButton(String name)
	{
		super(name);
		this.name = name;
	}
}

class MActionListener implements ActionListener
{
	String name;
	
	MActionListener(String name)
	{
		this.name = name;
	}
	
	public void actionPerformed(ActionEvent e){
	}
}
